
<style  lang="less">
 @import "templatePreview.less";
</style>
<template>
    <div>
        <Modal  width="60%" v-model="imgModel" :footer-hide="true"  :open-img-model="imgModel=true" @on-cancel="cancel" class="model"> 
            <div class="imgPreview">
                <div class="magnify-content">
                    <div class="magnify-img overflow">
                        <div class="fl preview_img">
                            <embed :src="previewPdfSrc" width="90%" height="90%" 
                                style="margin: auto;display: block;" 
                                ref="pdfPreview" 
                                type="application/pdf">
                            </embed>
                        </div>
                    </div>
                </div>
            </div> 
        </Modal>
    </div>
</template>
<script>
import {preview} from '@/projects/basic/api/template/template'
export default {
    data(){
        return{
            imgModel:false,
            previewPdfSrc:'',
            showType:"",
            curIndex:0,
            totalIndex:0,
            tempStyle:[],
        }
    },
    props: {
        printFormId: {
            type: String,
            require: true
        }
    },
    created(){
    },
    mounted(){
        this.loadPdf();
    },
    methods:{
            cancel(){
                this.$emit("close-pdf-model", false)
            },
            loadPdf(){
                let self = this;
                preview(self.printFormId).then(function (response) {
                    if (response.status === 200) {
                        let url = window.URL.createObjectURL(response.data);
                        self.previewPdfSrc = url;
                    }
                }).catch(function (error) {
                    console.log(error);
                });
            }
    }
}
</script>